package com.songcha.sakura.util

import java.net.URLDecoder
import java.net.URLEncoder

class UrlUtil {
    companion object{
          fun  urlEncoded(paramString:String?):String {
            if (paramString == null || paramString == "") {
                return "";
            }
            try {
                var str =  String(paramString.toByteArray(), Charsets.UTF_8);
                str = URLEncoder.encode(str, "UTF-8")
                return str
            } catch (e:Exception) {
                e.printStackTrace();
            }
            return "";
        }

        fun   urlDecoded(paramString:String?) :String{
            if (paramString == null || paramString=="") {
                return "";
            }
            try {
                var str =  String(paramString.toByteArray(), Charsets.UTF_8);
                str = URLDecoder.decode(str, "UTF-8")
                return str
                return str;
            } catch (e:Exception) {
                e.printStackTrace();
            }
            return "";
        }


    }
}